package com.exartisan.adapter;

import java.util.ArrayList;

import com.exartisan.bean.CommentPopup;
import com.exartisan.thanhdoanhn.R;
import com.loopj.android.image.SmartImageView;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PopupListAdapter extends BaseAdapter
{

	ArrayList<CommentPopup> data;
	Context context;
	
	CommentPopup cm;
	
	
	public PopupListAdapter(ArrayList<CommentPopup> data, Context context)
	{
		super();
		this.data = data;
		this.context = context;
	}

	@Override
	public int getCount()
	{
		return data.size();
	}

	@Override
	public long getItemId(int position)
	{
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View listView;
		if (convertView == null) {
			 
			listView = new View(context);
 
			//set row layout
			listView = inflater.inflate(R.layout.popup_rows, null);  
			
			// declare
			SmartImageView imgSurvey = (SmartImageView) listView.findViewById(R.id.imgSurvey);
			TextView titleTextView = (TextView)listView.findViewById(R.id.tvTitleSurvey);
			TextView startTimeTextView = (TextView)listView.findViewById(R.id.tvNumJoin);
			
			//fill data
			/*imgSurvey.setImageUrl("");
			titleTextView.setText(cm.getTitleSurvey());
			startTimeTextView.setText(cm.getTimeStart());
			endTimeTextView.setText(cm.getTimeEnd());*/
			
			
 
		} else {
			listView = (View) convertView;
		}
 
		return listView;
	}

	@Override
	public Object getItem(int position)
	{
		// TODO Auto-generated method stub
		return null;
	}
	
}
